<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 随机n位验证码
        //    一位一位的产生,然后进行字符串拼接   
        function randCode(n) {
            var res = '' ;
            for(var i = 0 ; i < n ; i++) {
                res += parseInt(Math.random() * 10) ;
            }
            return res ;
        }

    </script>
    
</body>
</html>